# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set(TEST_JS "${CMAKE_CURRENT_SOURCE_DIR}/big_file.js")
set(TEST_BIN "${CMAKE_CURRENT_BINARY_DIR}/big_file.abc")
set(TEST_MARKER "${CMAKE_CURRENT_BINARY_DIR}/big_file.ok")

add_custom_command(OUTPUT ${TEST_MARKER}
    COMMENT "Running javascript big_file testcase"
    COMMAND ${PANDA_RUN_PREFIX} $<TARGET_FILE:es2panda> ${TEST_JS} --opt-level=2 --output ${TEST_BIN}
    COMMAND ${CMAKE_COMMAND} -E touch ${TEST_MARKER}
    DEPENDS ${TEST_JS}
)
add_custom_target(ecmascript_big_file_test DEPENDS ${TEST_MARKER})
add_dependencies(ecmascript_big_file_test es2panda)
add_dependencies(ecmascript_common_tests ecmascript_big_file_test)
